import React from 'react';
import { Button } from 'antd';
import { Link } from 'dva/router';
import Result from 'components/Result';
import styles from './RegisterResult.less';

const loginActions = (
  <div className={styles.actions}>
    <Link to="/user/login">
      <Button size="large" type="primary">返回登录</Button>
    </Link>
  </div>
);

const registerActions = (
  <div className={styles.actions}>
    <Link to="/user/register">
      <Button size="large" type="primary">重新注册</Button>
    </Link>
  </div>
);

export default ({ location }) => (
  <Result
    className={styles.registerResult}
    type={location.state.type}
    title={
      <div className={styles.title}>
        你的账户：
        {location.state ? location.state.account: ''} {location.state.msg}
      </div>
    }
    description="欢迎使用绿萝，产品正在努力完善。如果您有任何疑问或建议，欢迎加入QQ群: 326428470"
    actions={location.state.type === "success" ? loginActions : registerActions}
    style={{ marginTop: 56 }}
  />
);
